<?php
$yii2appid = \common\config\Env::$yii2appid_appapi;
$config = [
    'id' => $yii2appid,
    'basePath' => dirname(__DIR__),
    'name' => "API-TITLE",
    'homeUrl' => '/appapi',
    'controllerNamespace' => 'appapi\controllers',
    'bootstrap' => [],
    'as cors' => [
        'class' => \common\members\wodrow\behaviors\CorsFilter::class,
    ],
    'components' => [
        'user' => [
            'class' => \common\rewrite\web\User::class,
            'identityClass' => \common\models\db\User::class,
            /*'enableAutoLogin' => true,
            'identityCookie' => [
                'name' => '_identity-api',
                'httpOnly' => true,
            ],*/
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => YII_ENV == 'dev'?true:false,
            'rules' => [],
        ],
        'assetManager' => [
            // 线上建议将forceCopy设置成false，如果访问量不大无所谓
            'forceCopy' => true,
            'linkAssets' => true,
            /*'assetMap' => [
                'AdminLTE.css' => '@wurl/css/AdminLTE.css',
            ],*/
        ],
        'appinfo' => [
            'class' => \common\members\wodrow\components\yii2app\Appinfo::class,
            'name' => $yii2appid,
        ],
        'equipmentInfo' => [
            'class' => \common\members\wodrow\components\equipment_info\EquipmentInfo::class,
            'equipmentClass' => \common\models\db\Equipment::class,
        ],
    ],
    'modules' => [
        'v0' => \appapi\modules\v0\V0::class,
    ],
    'as equipment check' => [
        'class' => \appapi\behaviors\EquipmentCheck::class,
        'except' => [
            'v0/public/*',
            'gii/*',
            'debug/*',
            'route/*',
//            'test/default/index',
        ],
    ],
    'as equipment user auth access' => [
        'class' => \appapi\behaviors\EquipmentUserAuthCheck::class,
        'except' => [
            'v0/public/*',
            'v0/site/*',
            'gii/*',
            'debug/*',
            'route/*',
        ],
    ],
    /*'as access' => [
        'class' => \yii\filters\AccessControl::class,
        'except' => [
            'public/*',
            'site/*',
            'gii/*',
            'debug/*',
            'route/*',
            'test/*',
        ],
        'rules' => [
            [
                'allow' => true,
                'roles' => ['@'],
            ],
        ],
    ],*/
    'params' => [],
];
$config = yii\helpers\ArrayHelper::merge(
    $config,
    \common\rewrite\deepziyu\yii_fast_api\Controller::getConfig()
);
$config['modules']['route'] = [
    'class' => \appapi\modules\route\Route::class,
];
return $config;